{include file="header.html"}
<script type="text/javascript">
$(function(){
    $('#category_form').validate({
        errorPlacement: function(error, element){
            $(element).next('.field_notice').hide();
            $(element).after(error);
        },
        success       : function(label){
            label.addClass('right').text('OK!');
        },
        onfocusout : false,
        onkeyup    : false,
        rules : {
            cate_name : {
                required : true,
                remote   : {                
                url :'index.php?app=placecategory&act=check_category',
                type:'get',
                data:{
                    cate_name : function(){
                        return $('#cate_name').val();
                    },
                    parent_id : function() {
                        return $('#parent_id').val();
                    },
                    id : '{$category.cate_id}'
                  }
                }
            },
            sort_order : {
                number   : true
            }
        },
        messages : {
            cate_name : {
                required : '分类名称不可为空',
                remote   : '此分类名称已被占用'
            },
            sort_order  : {
                number   : '不是数字'
            }
        }
    });
});
</script>
<div id="rightTop">
    <p>场景分类</p>
    <ul class="subnav">
        <li><a class="btn1" href="index.php?app=placecategory">管理</a></li>
        <li><!-- {if $category.cate_id} --><a class="btn1" href="index.php?app=placecategory&amp;act=add">添加</a><!-- {else} --><span>添加</span><!-- {/if} --></li>
    </ul>
</div>
<div class="info">
    <form method="post" enctype="multipart/form-data" id="category_form">
        <table class="infoTable">
            <tr>
                <th class="paddingT15">
                    分类名称:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="cate_name" type="text" name="cate_name" value="{$category.cate_name|escape}" /></td>
            </tr>
            <tr>
                <th class="paddingT15">
                    <label for="parent_id">上级分类:</label></th>
                <td class="paddingT15 wordSpacing5">
                    <select id="parent_id" name="parent_id"><option value="0">{$lang.select_pls}</option>{html_options options=$parents selected=$category.parent_id}</select></td>
            </tr>
            <tr>
                <th class="paddingT15">
                    排序:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="sort_order" id="sort_order" type="text" name="sort_order" value="{$category.sort_order}" /></td>
            </tr>
            <tr>
              <th class="paddingT15">显示:</th>
              <td class="paddingT15 wordSpacing5"><p>
                <label>
                  <input type="radio" name="is_show" value="1" {if $category.is_show}checked="checked"{/if} />
                  {$lang.yes}</label>
                <label>
                  <input type="radio" name="is_show" value="0" {if !$category.is_show}checked="checked"{/if} />
                  {$lang.no}</label>
              </p></td>
            </tr>

          <tr>
            <th></th>
            <td class="ptb20">
                <input class="formbtn" type="submit" name="Submit" value="{$lang.submit}" />
                <input class="formbtn" type="reset" name="reset" value="{$lang.reset}" />            </td>
        </tr>
        </table>
    </form>
</div>
{include file="footer.html"}
